<?php
/**
 * 注销登录
 * - 清除数组中的会话数据
 * - 清除会话cookie
 * - 销毁服务器上的会话数据
 */

// Need the utilities file:
require('includes/utilities.inc.php');

// Check for a user before attempting to actually log them out:
if ($user) {

	// 清除用户数据
	$user = null;

	// 清除会话数据
	$_SESSION = array();

	// 清除cookies
	setcookie(session_name(), false, time() - 3600);

	// 销毁会话
	session_destroy();

} // End of $user IF.

// Set the page title and include the header:
$pageTitle = 'Logout';
include('includes/header.inc.php');

// Need the view:
include('views/logout.html');

// Include the footer:
include('includes/footer.inc.php');